<meta charset="UTF-8">

<form role="form" id="pwdform">
		<div class="form-group">
			<label>旧的密码：</label>
				<input type="password"  name="password1" class="form-control" placeholder="旧密码">
		</div>
		<div class="form-group">
			<label>新的密码：</label>
				<input type="password"  name="password2" class="form-control" placeholder="新密码" >
		</div>
		<div class="form-group">
			<label>确认密码：</label>
				<input type="password" name="password3" class="form-control" placeholder="确认密码">
		</div>
</form>
	<script type="text/javascript" th:inline="javascript">
		var options = {
			message : '验证不通过',
			feedbackIcons : {
				valid : 'glyphicon glyphicon-ok',
				invalid : 'glyphicon glyphicon-remove',
				validating : 'glyphicon glyphicon-refresh'
			},
			fields : {
				password1 : {
					validators : {
						notEmpty : {
							message : '密码不能为空'
						}
					}
				},
				password2: {
				    validators: {
				    	notEmpty: {
							message:'密码不能为空'
						},
				        identical: {
				            field: 'password3',
				            message: '两次输入的密码不相符'
				        }
				    }
				},
				password3: {
				    validators: {
				    	notEmpty: {
							message:'密码不能为空'
						},
				        identical: {
				            field: 'password2',
				            message: '两次输入的密码不相符'
				        }
				    }
				},
				
			}
		};
		$('#pwdform').bootstrapValidator(options).on('success.form.bv',function(e) {
			e.preventDefault();//很重要没有它则会提交默认表单，不会做下面的ajax表单提交
		});
</script>